import * as React from 'react'
import './index.less'
import Loading from '../../../../components/Loading'
import {Link} from 'react-router-dom'
interface Props{
  lessons:any,
  getLessons:any
}

export default class HomeLessons extends React.Component
<Props> 
{
 
  
  render() { 
    let {hasMore,list,loading} = this.props.lessons
    console.log(this.props.lessons)
    return (
      <div className="home-lessons">
        <div className="all-lessons">
          <i className="iconfont icon-kecheng-copy"></i>
          <span>全部课程</span>
          {
            list.map((item,index:number)=>(
              <Link to={{pathname:`/detail/${item.id}`,state:item}} key={index}>
                <div  className="lesson">
                  <img src={item.poster}/>
                  <p>{item.title}</p>
                  <p>{item.price}</p>
                </div>
              </Link>
            ))
          }
          {
            loading?<Loading/>:(!hasMore&&<div className="load-more">我是有底线的</div>)
          }
        </div>
      </div>
    )
  }
}
 
